/**
 * author: zhou
 * date: 2017.10.18
 * description: 学校模型
 * {
 *      username: 用于生成学校管理员用户
 *      password: 用于生成学校管理员用户
 *      schoolName: 学校名称
 *      schoolmaster: 学校负责人
 *      province: 省份
 *      city: 城市
 *      area: 地区
 *      address: 地址
 *      introduction: 介绍
 *      count: 数量 teacher: 教师数量; student: 学生数量
 *      status: 1 正常 2 禁用 3 删除
 * }
 */

 const mongoose = require('mongoose');

 const schoolSchema = new mongoose.Schema({
    username: { type: String, unique: true, required: true },
    schoolName: String,
    schoolmaster: String,
    province: String,
    city: String,
    area: String,
    address: String,
    introduction: String,
    count: {
        teacher: { type: Number, default: 0 },
        student: { type: Number, default: 0 }
    },
    status: { type: Number, default: 1 },
    createDate: { type: Date, default: Date.now }
 });

 module.exports = mongoose.model('School', schoolSchema, 'managements.settings.schools');